<%@ page import="service.FinancingProductService" %>
<%@ page import="entity.FinancingProduct" %><%--
  Created by IntelliJ IDEA.
  User: 86134
  Date: 2024/10/9
  Time: 9:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String id = request.getParameter("id");
    FinancingProductService service = new FinancingProductService();
    FinancingProduct product = service.getProductById(id);
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑理财产品</title>
    <style>
        /* 简单样式 */
        .container {
            max-width: 400px;
            margin: auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        input[type="text"], select {
            width: 100%;
            padding: 12px 20px;
            margin: 8px 0;
            display: inline-block;
            border: 1px solid #ccc;
            box-sizing: border-box;
        }
        button {
            background-color: #4CAF50;
            color: white;
            padding: 14px 20px;
            margin: 8px 0;
            border: none;
            cursor: pointer;
            width: 100%;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>编辑理财产品</h2>
    <form action="update" method="post">
        <input type="hidden" name="id" value="<%= product.getId() %>">
        <label for="risk">风险评级:</label>
        <input type="number" id="risk" name="risk" value="<%= product.getRisk() %>" required><br>
        <label for="income">预期收益:</label>
        <input type="text" id="income" name="income" value="<%= product.getIncome() %>" required><br>
        <label for="saleStarting">发售起始日:</label>
        <input type="date" id="saleStarting" name="saleStarting" value="<%= product.getSaleStarting().toString() %>" required><br>
        <label for="saleEnd">发售截止日:</label>
        <input type="date" id="saleEnd" name="saleEnd" value="<%= product.getSaleEnd().toString() %>" required><br>
        <label for="end">产品到期日:</label>
        <input type="date" id="end" name="end" value="<%= product.getEnd().toString() %>" required><br>
        <button type="submit">保存更改</button>
    </form>
</div>
</body>
</html>
